package com.sgb.goods.view.adapter.publish;

import android.view.View;
import android.widget.EditText;

import androidx.databinding.ViewDataBinding;

import com.chad.library.adapter.base.BaseViewHolder;
import com.sgb.goods.BR;
import com.sgb.goods.R;
import com.sgb.goods.entity.StrengthEntity;
import com.sgb.goods.utils.base.adapter.BaseCommonAdapter;
import com.swgk.core.customview.DecimalInputTextWatcher;

public class AdmixtureAdapter extends BaseCommonAdapter<StrengthEntity> {

    public AdmixtureAdapter() {
        super(R.layout.goods_item_admixture, BR.viewModel);
    }

    @Override
    protected void convert(BaseViewHolder baseHolder, ViewDataBinding dataBinding, StrengthEntity entity) {
        if (baseHolder.getPosition() == getData().size() - 1) {
            baseHolder.getView(R.id.tv_line).setVisibility(View.GONE);
        }
        ((EditText) baseHolder.getView(R.id.et_price)).addTextChangedListener(
                new DecimalInputTextWatcher(((EditText) baseHolder.getView(R.id.et_price)),4,2));
    }
}
